const fs = require('fs');
// 创建可读流
const rs = fs.createReadStream('./test2.txt');
rs.on('open',()=>{
    console.log('可读流打开');
})

rs.on('close',()=>{
    console.log('可读流关闭')
})

// 读取文件
rs.on('data',data=>{
    console.log(data);
    console.log(data.toString());
})

/* 
可读流打开
<Buffer e5 93 b2 e4 b9 a6 e8 af b4 ef bc 9a e6 b4 8b e6 b4 8b e5 be 88 e5 b8 85 e6 b4 8b e6 b4 8b e8 af b4 ef bc 9a e5 93 b2 e4 b9 a6 e5 be 88 e5 a5 bd ef bc ... 64 more bytes>
可读流关闭


*/